<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>nice</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_001_014_1517">&nbsp;</a>NAME</h4><blockquote>
nice - invoke a utility with an altered system scheduling priority
</blockquote><h4><a name = "tag_001_014_1518">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

nice <b>[</b>-n <i>increment</i><b>] </b><i>utility </i><b>[</b><i>argument</i>...<b>]</b>

nice <b>[</b>-<i>increment</i><b>] </b><i>utility </i><b>[</b><i>argument</i>...<b>]</b>
</code>
</pre>
</blockquote><h4><a name = "tag_001_014_1519">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>nice</i>
utility invokes a utility, requesting that it be
run with a different system scheduling priority (see
the definition of
<b>system scheduling priority</b>
in the <b>XBD</b> specification, <a href="../xbd/glossary.html"><b>Glossary</b>&nbsp;</a> ).
With no options and only if the user has appropriate privileges,
the executed utility is run with a system scheduling priority
that is some implementation-dependent quantity less than
or equal to the system scheduling priority of the current process.
If the user
lacks appropriate privileges to affect the system scheduling
priority in the requested manner, the
<i>nice</i>
utility will not affect the
system scheduling priority;
in this case, a warning message may be written to standard error,
but this will not prevent the invocation of
<i>utility</i>
or affect the exit status.
</blockquote><h4><a name = "tag_001_014_1520">&nbsp;</a>OPTIONS</h4><blockquote>
The
<i>nice</i>
utility supports the <b>XBD</b> specification, <a href="../xbd/utilconv.html#usg"><b>Utility Syntax Guidelines</b>&nbsp;</a> 
except that
the obsolescent version allows a
multi-digit decimal integer as an option name.
<p>
The following option is supported:
<dl compact>

<dt><b>-n&nbsp;</b><i>increment</i>
<dd>
<dt><b>-</b><i>increment</i><dd>
Specify how the system scheduling priority of the executed
utility will be adjusted.
The
<i>increment</i>
option-argument is a positive or negative decimal integer that
will be used to modify the system scheduling priority of
the executed utility in an implementation-dependent manner.

Positive
<i>increment</i>
values cause a lower or unchanged system scheduling priority.
Negative
<i>increment</i>
values may require appropriate privileges and
will cause a higher or unchanged system scheduling priority.

The system scheduling priority is bounded
in an implementation-dependent manner.
If the requested
<i>increment</i>
would raise or lower the system scheduling priority of the executed
utility beyond implementation-dependent limits,
then the limit whose value was
exceeded is used.

</dl>
</blockquote><h4><a name = "tag_001_014_1521">&nbsp;</a>OPERANDS</h4><blockquote>
The following operands are supported:
<dl compact>

<dt><i>utility</i><dd>The name of a
utility that is to be invoked.
If the
<i>utility</i>
operand names any of the special built-in utilities in
<xref href=sbi><a href="chap2.html#tag_001_014">
Special Built-in Utilities
</a></xref>,
the results are undefined.

<dt><i>argument</i><dd>
Any string to be supplied as an argument when invoking the
utility named by the
<i>utility</i>
operand.

</dl>
</blockquote><h4><a name = "tag_001_014_1522">&nbsp;</a>STDIN</h4><blockquote>
Not used.
</blockquote><h4><a name = "tag_001_014_1523">&nbsp;</a>INPUT FILES</h4><blockquote>
None.
<br>
</blockquote><h4><a name = "tag_001_014_1524">&nbsp;</a>ENVIRONMENT VARIABLES</h4><blockquote>
The following environment variables affect the execution of
<i>nice</i>:
<dl compact>

<dt><i>LANG</i><dd>Provide a default value for the internationalisation variables
that are unset or null.
If
<i>LANG</i>
is unset or null, the corresponding value from the
implementation-dependent default locale will be used.
If any of the internationalisation variables contains an invalid setting, the
utility will behave as if none of the variables had been defined.

<dt><i>LC_ALL</i><dd>
If set to a non-empty string value,
override the values of all the other internationalisation variables.

<dt><i>LC_CTYPE</i><dd>
Determine the
locale for the interpretation of sequences of bytes of text data as
characters (for example, single- as opposed to multi-byte characters
in arguments).

<dt><i>LC_MESSAGES</i><dd>
Determine the locale that should be used to affect
the format and contents of diagnostic
messages written to standard error.

<dt><i>NLSPATH</i><dd>
Determine the location of message catalogues
for the processing of
<i>LC_MESSAGES .
</i>
<dt><i>PATH</i><dd>Determine the search path
used to locate the utility to be invoked.
See
the <b>XBD</b> specification, <a href="../xbd/envvar.html"><b>Environment Variables</b>&nbsp;</a> .

</dl>
</blockquote><h4><a name = "tag_001_014_1525">&nbsp;</a>ASYNCHRONOUS EVENTS</h4><blockquote>
Default.
</blockquote><h4><a name = "tag_001_014_1526">&nbsp;</a>STDOUT</h4><blockquote>
Not used.
</blockquote><h4><a name = "tag_001_014_1527">&nbsp;</a>STDERR</h4><blockquote>
Used only for diagnostic messages.
</blockquote><h4><a name = "tag_001_014_1528">&nbsp;</a>OUTPUT FILES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_1529">&nbsp;</a>EXTENDED DESCRIPTION</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_1530">&nbsp;</a>EXIT STATUS</h4><blockquote>
If the
<i>utility</i>
utility is invoked, the exit status of
<i>nice</i>
will be the exit status of
<i>utility;</i>
otherwise, the
<i>nice</i>
utility will exit with one of the following values:
<dl compact>

<dt>1'<dd>An error occurred in the
<i>nice</i>
utility.

<dt>126<dd>The utility specified by
<i>utility</i>
was found but could not be invoked.

<dt>127<dd>The utility specified by
<i>utility</i>
could not be found.

</dl>
</blockquote><h4><a name = "tag_001_014_1531">&nbsp;</a>CONSEQUENCES OF ERRORS</h4><blockquote>
Default.
<br>
</blockquote><h4><a name = "tag_001_014_1532">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
Note that, in the obsolescent version,
<b>-5</b>
is a positive
<i>increment</i>,
while
<b>--5</b>
is a negative
<i>increment</i>.
<p>
The only guaranteed portable uses of this utility are:
<dl compact>

<dt><i>nice utility</i><dd>
Run
<i>utility</i>
with the default lower system scheduling priority.

<dt><i>nice </i><b>-n </b><i>&lt;positive integer&gt; utility</i><dd>
Run
<i>utility</i>
with a lower system scheduling priority.

</dl>
<p>
On some systems they will have no discernible effect
on the invoked utility
and on some others they will be exactly equivalent.
<p>
Historical systems have frequently supported the
&lt;<i>positive integer</i>&gt;
up to 20.
Since there is no error penalty associated
with guessing a number that is too high,
users without access to the system conformance
document (to see what limits are actually in place)
could use the historical 1 to 20 range or attempt
to use very large numbers if the job should be
truly low priority.
<p>
The system scheduling priority
value of a process can be displayed using the command:
<pre>
<code>
ps -o nice
</code>
</pre>
<p>
The
<i><a href="command.html">command</a></i>,
<i><a href="env.html">env</a></i>,
<i>nice</i>,
<i><a href="nohup.html">nohup</a></i>,
<i><a href="time.html">time</a></i>
and
<i><a href="xargs.html">xargs</a></i>
utilities have been specified to use
exit code 127 if an error occurs so that
applications can distinguish
&quot;failure to find a utility&quot; from &quot;invoked utility exited
with an error indication&quot;.
The value 127 was chosen because it is not commonly used for other meanings;
most utilities use small values for &quot;normal error conditions&quot; and
the values above 128 can be confused with termination due to receipt of a
signal.
The value 126
was chosen in a similar manner to indicate that the utility
could be found, but not invoked.
Some scripts produce meaningful error messages
differentiating the 126 and 127 cases.
The distinction between exit codes 126 and 127 is based
on KornShell practice that uses 127 when all attempts to
<i>exec</i>
the utility fail with
[ENOENT],
and uses 126 when any attempt to
<i>exec</i>
the utility fails for any other reason.
</blockquote><h4><a name = "tag_001_014_1533">&nbsp;</a>EXAMPLES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_1534">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_1535">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="renice.html">renice</a></i>.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
